<!DOCTYPE html>
<html lang="zh-CN" ng-app='he'>
	<head>
		<meta charset='utf-8' />
	
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>审批记录</title>
		<script type="text/javascript">
			is_local='{{local}}';
			function loadcss(cssfile) {
		        document.write('\<link rel="stylesheet" href="' + cssfile +'" type="text/css"/\>');
		    }
			function loadjs(script_filename) {
		        document.write('\<script language="javascript" type="text/javascript" src="' + script_filename + '"\>\</script\>');
		    }
		    if(!is_local){
			    static_url='/static';
		    }else{
			    static_url='../../../../static';
		    }
		    // 加载所有微信页面需要的js和css
		    loadjs(static_url+'/js/weixin_page.js')
		</script>
		<script type="text/javascript">
			var app = angular.module('he',['ngSanitize']);
			app.config(function($interpolateProvider) {
				  $interpolateProvider.startSymbol('[[');
				  $interpolateProvider.endSymbol(']]');
				});
			app.controller('content',function ($scope,$http) {
				// 设置body里面的变量
				if(is_local){
					$scope.records=[
							{approve_url:'#/?id=100',gen_time:'2016-01-20 16:31',status:'pending',title:'heyulin apply for annual day'},
							{approve_url:'100',gen_time:'2016-01-21 13:31',status:'approved',title:'heyulin apply for annual day'},
							{approve_url:'100',gen_time:'2016-01-21 13:31',status:'rejected',title:'heyulin apply for annual day'}
						]
				}else{
					// 从服务器初始化
					var post_url='/attendance/ajax/';
					function init_from_server() {
							var post_data = {
									approval_history:{},
								};  
							$http.post(post_url,post_data)
							.success(function(data, status, headers, config) { 
								$scope.records=data.approval_history;
							}).error(function(data, status, headers, config) {  
							    //处理错误 
							    $scope.std='有错误,返回码为:'+status;
							});
					}
					init_from_server();
					//--------------------------------------
				}
				$scope.test_click=function () {
					info('hello');
				}
			})
		</script>
	</head>
	<body ng-controller='content'>
		<!-----------------在这里填写内容------------------------>
		<div class="container" ng-controller='content'>
    <div class="row">
        <div class="col-xs-12" >
            <div class="record-row" ng-repeat='record in records | orderBy:"-gen_time"'>
	            <a ng-href="[[record.approve_url]]">
		            <span class="record-time" ng-bind='record.gen_time'>2016-01-20 16:31</span>
                <span class="record-status" ng-bind='record.status' ng-class='record.status'>Pending</span>
                <p class="texts" ng-bind='record.title'>Zhou Yan apply for personal leave 5 days.</p>
	            </a>
                
            </div>
            <div ng-show='records.length==0'>
	            没有您的审批记录
            </div>
        </div>
    </div>
</div>
		
		<!-----------------弹出框------------------------>
		<div ng-include src='"info_panel.html"'></div>
		
	</body>
</html>